package com.dmall.scf.utils.express.operator;

import com.ql.util.express.Operator;
import com.ql.util.express.OperatorOfNumber;

public class OperatorSum extends Operator {

    public OperatorSum(String name) {
        this.name = name;
    }

    @Override
    public Object executeInner(Object[] list) throws Exception {
        if (list.length == 0) {
            throw new Exception("操作数异常");
        }
        Object result = list[0];
        for (int i = 1; i < list.length; i++) {
            result = OperatorOfNumber.add(result, list[i], this.isPrecise);
        }
        return result;
    }
}
